package summerService

import (
	"webGoDemo/model"
	summerContainer2 "webGoDemo/summer/summerContainer"
	summerRepo2 "webGoDemo/summer/summerRepo"
)

type UserServiceImp struct {
}

func InitUserService() {
	summerContainer2.Add("UserService", UserServiceImp{
	})
}

func (u UserServiceImp) ListAllUser() ([]*model.User, error) {

	useRepo := summerContainer2.Get("UserRepo").(summerRepo2.UserRepo)
	users, err := useRepo.ListUser()

	if err != nil {
		return nil, err
	}
	return users, nil

}
